﻿using SPW.Infrastructure.Models;
using SPW.Infrastructure.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SPW.Infrastructure.Interfaces
{
    /// <summary>
    /// 数据服务客户端
    /// </summary>
    public interface IDataServiceClient
    {
        /// <summary>
        /// 访问token
        /// </summary>
        string AccessToken { get; }
        /// <summary>
        /// 刷新id
        /// </summary>
        string RefreshId { get; }
        /// <summary>
        /// 用户id
        /// </summary>
        string UserId { get; }
        /// <summary>
        /// 用户昵称
        /// </summary>
        string NickName { get; }
        /// <summary>
        /// 设置调试状态
        /// </summary>
        /// <param name="success"></param>
        void SetDebugState(bool success);
        /// <summary>
        /// 设置token
        /// </summary>
        /// <param name="access_token"></param>
        void SetToken(string access_token);
        /// <summary>
        /// 异步认证
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        Task<bool> AuthenticatorAsync(string username, string password);
        /// <summary>
        /// 异步刷新
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> RefreshAsync(string id);
        /// <summary>
        /// 异步 Get
        /// </summary>
        /// <param name="urlPathString"></param>
        /// <param name="datas"></param>
        /// <returns></returns>
        Task<ResultDataModel> HttpGetAsync(string urlPathString, Dictionary<string, string> datas = null);
        Task<TResult> HttpGetAsync<TResult>(string urlPathString, Dictionary<string, string> datas = null) where TResult : class, new();
        Task<ResultDataModel> HttpPostAsync(string urlPathString, Dictionary<string, string> datas);
        Task<ResultDataModel> HttpPostAsync(string urlPathString, object datas);
        Task<TResult> HttpPostAsync<TResult>(string urlPathString, Dictionary<string, string> datas) where TResult : class, new();
        Task<TResult> HttpPostAsync<TResult>(string urlPathString, object datas) where TResult : class, new();
        Task<ResultDataModel> HttpPutAsync(string urlPathString, string id, Dictionary<string, string> datas);
        Task<TResult> HttpPutAsync<TResult>(string urlPathString, string id, Dictionary<string, string> datas) where TResult : class, new();
        Task<ResultDataModel> HttpPutAsync(string urlPathString, string id, object datas);
        Task<TResult> HttpPutAsync<TResult>(string urlPathString, string id, object datas) where TResult : class, new();
        Task<ResultDataModel> HttpDeleteAsync(string urlPathString, string id);
        Task<TResult> HttpDeleteAsync<TResult>(string urlPathString, string id) where TResult : class, new();
    }
}
